import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;




public class DBConnect {
	
	final private static String driverName = "oracle.jdbc.driver.OracleDriver";
	private static String url;
	final private static String server = "127.0.0.1";
	final private static String port = "1521";
	final private static String sid = "XE";
	final private static String username = "objectman";
	final private static String password = "objectman";
	private static Connection connection;
	private static boolean isConnected = false;
	
	private static boolean connect() {
	    try {
	        url = "jdbc:oracle:thin:@" + server + ":" + port + ":" + sid;
	        System.out.println(url);
	        Class.forName(driverName);
	        connection = DriverManager.getConnection(url, username, password);
	        System.out.println("connecting: " + url);
	        if(connection.equals(null))
	            isConnected = false;
	        else
	            isConnected = true;
	    } catch (ClassNotFoundException e) {
	        System.out.println("ClassNotFoundException");
	        isConnected = false;
	    } catch (SQLException e) {
	        System.out.println("SQLException\n" + e.getMessage());
	        isConnected = false;
	    }
	    return isConnected;
	}
	
	public static void main()
	{

	}
}